package tools;

public class AverageCalc {
	public static void main(String[] argv){
		String input = "352483 351318 355849 353604 351664 352274 343227 342675 329612 330414 354326 353641 339762 340947 349257 347963 334785 333269 348764 349505 346093 345476 344027 345684 338854 335891 346597 348415 344133 345729 338480 337885 340738 343367 341594 341974 347449 348206 338162 338864 326024 323537 355525 352775 332889 330698 328918 327923 349503 349056";
		String[] nums = input.split(" ");
		double[] numsd = new double[nums.length];
		for(int i = 0; i < nums.length; i++){
			numsd[i] = Integer.parseInt(nums[i]);
			System.out.print((int)numsd[i]+"\t");
		}
		System.out.println();
		int total = 0;
		for(int i = 0; i < nums.length; i++){
			total += numsd[i];
		}
		System.out.println("total: "+total);
		double mean = total * 1.0 / nums.length;
		double variance = 0;
		for(int i = 0; i < nums.length; i++){
			double dev = numsd[i] - mean;
			double devS = Math.pow(dev, 2);
			variance += devS;
//			System.out.println("Value: "+numsd[i]+" Dev: "+dev+" DevS: "+devS);
		}
		double standardDeviation = Math.pow(variance / (nums.length-1),0.5);
		System.out.println("Mean: "+mean/100);
//		System.out.println("SD: "+standardDeviation);
	}
}
